package main

import (
	"example.com/go-vue.git/app"
	_ "example.com/go-vue.git/backstage"
	"example.com/go-vue.git/common/database"
	"example.com/go-vue.git/common/log"
	"example.com/go-vue.git/config"
	"github.com/gin-gonic/gin"
	"github.com/sirupsen/logrus"
)

/*
程序主入口
*/
func main() {
	gin.Default()
	r := app.Init()
	//开启配置文件
	if _, err := config.ParseConfig(config.Debug); err != nil {
		log.App("配置文件不存在", logrus.Fields{"err": err})
	}
	//连接数据库
	database.Init()
	//开启配置文件
	port := config.GetConfig().AppPort
	if err := r.Run(":" + port); err != nil {
		log.App("项目启动失败", logrus.Fields{"err": err})
	}
	log.App("项目启动成功", logrus.Fields{"port": port})
}
